/*    */ package com.gillion.grule.client.validator;
/*    */ 
/*    */ import java.util.Map;
/*    */ import org.apache.commons.lang3.StringUtils;
/*    */ import org.apache.commons.lang3.Validate;
/*    */ 
/*    */ 
/*    */ 
/*    */ public class TypeValidatorServiceImpl
/*    */   implements ValidatorService
/*    */ {
/*    */   public boolean validate(String key, Object value, Map<String, Object> settings) {
/*    */     String type;
/* 14 */     Validate.notEmpty(key, "校验的Key值不能为空。", new Object[0]);
/* 15 */     Validate.notEmpty(settings, "配置对象不能为空。", new Object[0]);
/*    */ 
/*    */ 
/*    */     
/* 19 */     if (settings.containsKey("type")) {
/* 20 */       type = (String)settings.get("type");
/*    */     } else {
/* 22 */       throw new RuntimeException("在类型校验中未配置对应的类型，请检查。");
/*    */     } 
/* 24 */     if (value != null && !StringUtils.equals(value.getClass().getName(), type) && settings.get("message") != null) {
/* 25 */       return false;
/*    */     }
/* 27 */     return true;
/*    */   }
/*    */ }


/* Location:              D:\apache-tomcat-9.0.76\webapps\grule-manager\WEB-INF\lib\grule-client-2.0.2.RELEASE.jar!\com\gillion\grule\client\validator\TypeValidatorServiceImpl.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */